package com.baidu.bos.web.action;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.baidu.bos.domain.Role;
import com.baidu.bos.service.IRoleService;
import com.baidu.bos.web.action.base.BaseAction;

@Controller
@Scope("prototype")
public class RoleAction extends BaseAction<Role>{
	@Resource
	private IRoleService roleService;
	
	private String functionIds;
	public void setFunctionIds(String functionIds) {
		this.functionIds = functionIds;
	}
	//保存角色
	public String save(){
		roleService.save(model,functionIds);
		return "list";
	}
	
	//分页查询所有角色信息
	public String pageQuery(){
		roleService.pageQuery(pageBean);
		this.writeObject2Json(pageBean);
		return NONE;
	}
	
	//查询所有角色信息加载到页面
	public String list(){
		List<Role> list = roleService.findAll();
		this.writeObject2Json(list);
		return NONE;
	}
}
